import { request } from 'umi';

import {
  UserListParamsType,
  UserInfoParamsType,
  AreaListParamsType,
  DeleteUserTypeReturnType,
  AddUserTypeReturnType,
} from './API';
//
export async function queryAreaListAPI(params?: AreaListParamsType) {
  return request<API.APIReturnType<any>>('/api/area/listArea', { params: params || {} });
}

export async function queryUserListAPI(params?: UserListParamsType) {
  return request<API.APIReturnType<any>>('/api/user/list', { params: params || {} });
}
export async function addUserAPI(params?: AddUserTypeReturnType) {
  return request<API.APIReturnType<any>>('/api/user/add', { method: 'post', data: params || {} });
}
export async function deleteUserAPI(params?: DeleteUserTypeReturnType) {
  return request<API.APIReturnType<any>>('/api/user/delete', {
    method: 'post',
    data: params || {},
  });
}
export async function editUserAPI(params?: AddUserTypeReturnType) {
  return request<API.APIReturnType<any>>('/api/user/edit', { method: 'post', data: params || {} });
}
export async function queryUserInfoAPI(params?: UserInfoParamsType) {
  return request<API.APIReturnType<any>>('/api/user/info', { params: params || {} });
}
